package com.abu.consumer.controller;

import com.abu.provider.ProviderService;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author liu kang
 * @Date 2021/08/11 16:50
 * @Description
 */
@Slf4j
@RestController
@RequestMapping("cons")
public class ConsController {

    @DubboReference
    private ProviderService providerService;

    @NacosValue(value = "${age}", autoRefreshed = true)
    private Integer age;

    @GetMapping("pro")
    public Object queryOneProvider() {
        String name = this.providerService.getOne();
        log.info(String.valueOf(age));
        return name;
    }
}
